<!DOCTYPE html	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:sdu="http://sduept.com/jsf/cc">
<h:head>
	<link href="/css/primefaces/menubase.css" rel="stylesheet"
		type="text/css" />
	<title>选择运维单位</title>
	<style type="text/css">
.value {
	font-weight: bold;
}
.ui-tree {
	width: 600px;
    position: relative;
    height: 500px;
    overflow-y: scroll;
}

</style>
</h:head>
	<h:body>
		<h:form id="toolbarForm">
			<p:toolbar id="toolbar">
				<f:facet name="left">
					<p:autoComplete placeholder="输入部门首字母可查" id="opDept" size="20"
						value="#{opSubCompanyDepartSelectorController.dept}"
						completeMethod="#{opSubCompanyDepartSelectorController.completeMaintenanceUnit}"
						scrollHeight="400" style="float:left;margin-top:5px;">
						<p:ajax update="opDept treeForm:opTree" event="itemSelect"
							listener="#{opSubCompanyDepartSelectorController.autoCompleteOpTree}" />
					</p:autoComplete>
					<p:commandButton icon="fa fa-refresh"
						style="margin-left:5px;" value="刷新"
						update="opDept treeForm:opTree okBtn"
						actionListener="#{opSubCompanyDepartSelectorController.refreshOpTree}" />
					<p:commandButton value="部门维护" icon="fa fa-cog" style="margin-left:5px;"
						onclick='window.open("/ui/org/permission/organizationPermissionManager.xhtml","_blank")'/>
				</f:facet>
				<f:facet name="right">
					<p:commandButton value="确定" ajax="false" style="margin-right: 50px;" id="okBtn"
						actionListener="#{opSubCompanyDepartSelectorController.selectOpDepart}"
						disabled="#{opSubCompanyDepartSelectorController.selectedNode==null}" />
				</f:facet>
			</p:toolbar>
		</h:form>
		<h:form id="treeForm">
			<p:tree id="opTree" widgetVar="opTree" dynamic="true" 
				animate="true" var="node" style="border:0"
				value="#{opSubCompanyDepartSelectorController.opSubCompanyTree}"
				selectionMode="single" selection="#{opSubCompanyDepartSelectorController.selectedNode}" >
				<p:ajax event="select" update="toolbarForm:toolbar"
					listener="#{opSubCompanyDepartSelectorController.onNodeSelect}" />
				<p:ajax event="expand" update="treeForm:opTree" 
					listener="#{opSubCompanyDepartSelectorController.onNodeExpand}" />
				<p:treeNode type="root">
					<h:outputText value="#{node}" />
				</p:treeNode>
				<p:treeNode type="maintenanceScope">
					<h:outputText value="#{node}" />
				</p:treeNode>
				<p:treeNode type="maintenanceUnit">
					<h:outputText value="#{node}" />
				</p:treeNode>
			</p:tree>
		</h:form>
	</h:body>
</html>
